/**
 * OWASP GoatDroid Project
 * 
 * This file is part of the Open Web Application Security Project (OWASP)
 * GoatDroid project. For details, please see
 * https://www.owasp.org/index.php/Projects/OWASP_GoatDroid_Project
 *
 * Copyright (c) 2011 - The OWASP Foundation
 * 
 * GoatDroid is published by OWASP under the GPLv3 license. You should read and accept the
 * LICENSE before you use, modify, and/or redistribute this software.
 * 
 * @author Jack Mannino, nVisium Security (https://www.nvisiumsecurity.com)
 * @created 2011
 */
package org.owasp.goatdroid.fourgoats.webservice.resources;

import javax.ws.rs.CookieParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.owasp.goatdroid.fourgoats.webservice.Constants;
import org.owasp.goatdroid.fourgoats.webservice.rewards.RewardsBean;
import org.owasp.goatdroid.fourgoats.webservice.rewards.RewardsImpl;

@Path("/fourgoats/api/v1/rewards")
public class Rewards {

	@Path("all_rewards")
	@GET
	@Produces("application/json")
	public RewardsBean getRewards(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken) {

		return RewardsImpl.getAllRewards(sessionToken);
	}

	@Path("my_rewards")
	@GET
	@Produces("application/json")
	public RewardsBean getMyEarnedRewards(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken) {

		return RewardsImpl.getMyEarnedRewards(sessionToken);
	}

	@Path("add")
	@GET
	@Produces("application/json")
	public RewardsBean addNewReward(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken,
			@QueryParam("rewardName") String rewardName,
			@QueryParam("rewardDescription") String rewardDescription,
			@QueryParam("venueID") String venueID,
			@QueryParam("checkinsRequired") int checkinsRequired) {

		return RewardsImpl.addNewReward(sessionToken, rewardName,
				rewardDescription, venueID, checkinsRequired);
	}
}
